====== Randomization: Texts ======

**Note:** This page explains how to [[en:create:randomization|randomize]] texts with a [[en:create:questions:random|Random Generator]] and some [[en:create:php|PHP code]]. Since this is already the 2nd step of the procedure, please read the [[en:create:randomization-php]] page first.


If your stimulus is a text, the function [[en:create:functions:text|text()]] must be used when including it via [[en:create:php|PHP code]]. This function embeds the HTML code as a text module in a page. 

At first you need to create a random generator (siehe [[de:create:randomization-php]]). The next step is to create the stimulus texts as **Text** in the **List of Questions**. After that, when **Compose Questionnaire**, you place a PHP code on the page under the random generator. This code might look like this:

<code php>
if (value('RG01') == 2) {
  text('ST01');
} elseif (value('RG01') == 3) {
  text('ST02');
}
</code>

With this PHP code, the group "Positive case studies" (random generator value RG01=2) would display the text with the ID "ST01", the group "Negative case studies" (random generator value RG01=3) would display the text with the ID "ST02", and the control group (random generator value RG01=1) would display nothing.